<template>
	<view class="container">
		<u-navbar title-size="34" back-icon-color="#292940" :isBack="false" :border-bottom="false" :custom-back="tui.goBack"
			placeholder>
		</u-navbar>
		<view>
			<view class="success-img">
				<image src="/static/market/pay-success.png"></image>
			</view>
			<view class="text-333333 fz-44 text-center">支付成功</view>
			<view class="btn-box" v-if="activity_id">
				<view class="success-btn main-bg text-center text-ffffff fz-36" @click="toCollection">查看藏品</view>
				<view class="success-btn back-btn text-2C2C2C fz-34 text-center" @click="toCard">返回活动</view>
			</view>
			<view class="btn-box" v-else>
				<view class="success-btn main-bg text-center text-ffffff fz-36" @click="toBoxCollection" v-if="blind_box_id != 0">查看藏品</view>
				<view class="success-btn main-bg text-center text-ffffff fz-36" @click="toCollection" v-else>查看藏品</view>
				<view class="success-btn back-btn text-2C2C2C fz-34 text-center" @click="toMarket">返回市场</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				activity_id:'',
				blind_box_id:'',
				work_id:''
			}
		},
		onLoad(options) {
			this.activity_id = options.activity_id || ''
			this.work_id = options.work_id || ''
			this.blind_box_id = options.blind_box_id || ''
			this.$store.commit('works/SET_ISREFRESH',true)
			this.$store.commit('works/SET_ISREFRESHMARKET',true)
		},
		//安卓实体返回判断
		onBackPress(event) {
			if(event.from == 'backbutton'){
				this.toCollection()
				return true
			}
		},
		methods:{
			//返回藏品盲盒
			toBoxCollection(){
				this.$store.commit('works/SET_TITLECURRENT',1)
				uni.switchTab({
					url:`/pages/tabBars/collection`
				})
			},
			//查看藏品
			toCollection(){
				this.$store.commit('works/SET_TITLECURRENT',0)
				uni.redirectTo({
					url:`/pages/secondary/collection/index?work_id=${this.work_id}`
				})
			},
			//返回活动
			toCard(){
				uni.redirectTo({
					url:`/pages/secondary/card?activity_id=${this.activity_id}`
				})
			},
			//订单列表
			toOrderList(){
				uni.navigateTo({
					url:'/pages/secondary/mine/order-list?current=0'
				})
			},
			//返回市场
			toMarket(){
				uni.switchTab({
					url:'/pages/tabBars/market'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.container {
		width: 100%;
		height: 100vh;
		background: #ffffff;
	}


	.success-img {
		width: 285upx;
		height: 280upx;
		margin: 100upx auto 60upx;

		image {
			width: 285upx;
			height: 280upx;
		}
	}

	.btn-box {
		margin-top: 170upx;
	}

	.success-btn {
		width: 630upx;
		height: 98upx;
		line-height: 98upx;
		border-radius: 49upx;
		margin: 0 auto;
		margin-bottom: 40upx;
	}

	.back-btn {
		border: 2upx solid #CCCDD5;
	}
</style>
